app.controller('ModalCtrl', function ($scope, $modalInstance, param) {

	$scope.param = param;
	if ($scope.param.data == null) $scope.param.data = {};

	$scope.ok = function () {
		if ($scope.myForm) {
			if ($scope.myForm.$valid) $modalInstance.close($scope.param);
		} else {
			$modalInstance.close($scope.param);
		}
	};

	$scope.cancel = function () {
		$modalInstance.dismiss('cancel');
	};
});